cmake_minimum_required(VERSION 3.16)

project(UserRepository LANGUAGES CXX)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(QT NAMES Qt6 REQUIRED COMPONENTS Core Sql)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Sql)

add_library(UserRepository SHARED
  UserRepository_global.h
  UserRepository.cpp
  UserRepository.h
)

target_link_libraries(UserRepository PRIVATE
  Qt${QT_VERSION_MAJOR}::Core
  Qt${QT_VERSION_MAJOR}::Sql
  )

target_compile_definitions(UserRepository PRIVATE USERREPOSITORY_LIBRARY)
